{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "56ddf5a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 练习课本P4，涉及知识点：模块，变量，条件判断"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "22f95f45",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f5c16ac6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "odds = [ 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,39,41,43,45,47,49,51,53,55,57,59 ]\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else: \n",
    "    print(\"Not an odd minute.\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "65af31c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 练习课本P33，涉及知识点：模块，变量，条件判断，time模块，for循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "95e92ab9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前是偶数秒 56\n",
      "等待时间（随机)： 4\n",
      "------\n",
      "当前是偶数秒 0\n",
      "等待时间（随机)： 3\n",
      "------\n",
      "当前是奇数秒 3\n",
      "等待时间（随机)： 5\n",
      "------\n",
      "当前是偶数秒 8\n",
      "等待时间（随机)： 2\n",
      "------\n",
      "当前是偶数秒 10\n",
      "等待时间（随机)： 5\n",
      "------\n"
     ]
    }
   ],
   "source": [
    "# from datetime import detatime\n",
    "import datetime\n",
    "import time,random\n",
    "\n",
    "odds = [1, 3, 5, 7, 9, 11,13,15,17,19,\n",
    "           21,23,25,27,29,31,33,35,37,39,\n",
    "           41,43,45,47,49,51,55,51,59]\n",
    "\n",
    "for i in range(5):\n",
    "    \n",
    "    right_this_seconds = datetime.datetime.today().second\n",
    "    if right_this_seconds in odds:\n",
    "        print(\"当前是奇数秒\",right_this_seconds)\n",
    "    else:\n",
    "        print(\"当前是偶数秒\",right_this_seconds)\n",
    "    wait_time = random.randint(1,5)\n",
    "    print(\"等待时间（随机)：\",wait_time)\n",
    "    time.sleep(wait_time)\n",
    "    print(\"------\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "8cb3cee8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 练习课本P44，涉及知识点：变量，条件判断，for循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b5215432",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottles 在啤酒墙上\n",
      "99 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "98 bottles 在啤酒墙上\n",
      "------\n",
      "98 bottles 在啤酒墙上\n",
      "98 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "97 bottles 在啤酒墙上\n",
      "------\n",
      "97 bottles 在啤酒墙上\n",
      "97 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "96 bottles 在啤酒墙上\n",
      "------\n",
      "96 bottles 在啤酒墙上\n",
      "96 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "95 bottles 在啤酒墙上\n",
      "------\n",
      "95 bottles 在啤酒墙上\n",
      "95 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "94 bottles 在啤酒墙上\n",
      "------\n",
      "94 bottles 在啤酒墙上\n",
      "94 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "93 bottles 在啤酒墙上\n",
      "------\n",
      "93 bottles 在啤酒墙上\n",
      "93 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "92 bottles 在啤酒墙上\n",
      "------\n",
      "92 bottles 在啤酒墙上\n",
      "92 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "91 bottles 在啤酒墙上\n",
      "------\n",
      "91 bottles 在啤酒墙上\n",
      "91 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "90 bottles 在啤酒墙上\n",
      "------\n",
      "90 bottles 在啤酒墙上\n",
      "90 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "89 bottles 在啤酒墙上\n",
      "------\n",
      "89 bottles 在啤酒墙上\n",
      "89 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "88 bottles 在啤酒墙上\n",
      "------\n",
      "88 bottles 在啤酒墙上\n",
      "88 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "87 bottles 在啤酒墙上\n",
      "------\n",
      "87 bottles 在啤酒墙上\n",
      "87 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "86 bottles 在啤酒墙上\n",
      "------\n",
      "86 bottles 在啤酒墙上\n",
      "86 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "85 bottles 在啤酒墙上\n",
      "------\n",
      "85 bottles 在啤酒墙上\n",
      "85 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "84 bottles 在啤酒墙上\n",
      "------\n",
      "84 bottles 在啤酒墙上\n",
      "84 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "83 bottles 在啤酒墙上\n",
      "------\n",
      "83 bottles 在啤酒墙上\n",
      "83 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "82 bottles 在啤酒墙上\n",
      "------\n",
      "82 bottles 在啤酒墙上\n",
      "82 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "81 bottles 在啤酒墙上\n",
      "------\n",
      "81 bottles 在啤酒墙上\n",
      "81 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "80 bottles 在啤酒墙上\n",
      "------\n",
      "80 bottles 在啤酒墙上\n",
      "80 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "79 bottles 在啤酒墙上\n",
      "------\n",
      "79 bottles 在啤酒墙上\n",
      "79 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "78 bottles 在啤酒墙上\n",
      "------\n",
      "78 bottles 在啤酒墙上\n",
      "78 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "77 bottles 在啤酒墙上\n",
      "------\n",
      "77 bottles 在啤酒墙上\n",
      "77 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "76 bottles 在啤酒墙上\n",
      "------\n",
      "76 bottles 在啤酒墙上\n",
      "76 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "75 bottles 在啤酒墙上\n",
      "------\n",
      "75 bottles 在啤酒墙上\n",
      "75 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "74 bottles 在啤酒墙上\n",
      "------\n",
      "74 bottles 在啤酒墙上\n",
      "74 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "73 bottles 在啤酒墙上\n",
      "------\n",
      "73 bottles 在啤酒墙上\n",
      "73 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "72 bottles 在啤酒墙上\n",
      "------\n",
      "72 bottles 在啤酒墙上\n",
      "72 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "71 bottles 在啤酒墙上\n",
      "------\n",
      "71 bottles 在啤酒墙上\n",
      "71 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "70 bottles 在啤酒墙上\n",
      "------\n",
      "70 bottles 在啤酒墙上\n",
      "70 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "69 bottles 在啤酒墙上\n",
      "------\n",
      "69 bottles 在啤酒墙上\n",
      "69 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "68 bottles 在啤酒墙上\n",
      "------\n",
      "68 bottles 在啤酒墙上\n",
      "68 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "67 bottles 在啤酒墙上\n",
      "------\n",
      "67 bottles 在啤酒墙上\n",
      "67 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "66 bottles 在啤酒墙上\n",
      "------\n",
      "66 bottles 在啤酒墙上\n",
      "66 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "65 bottles 在啤酒墙上\n",
      "------\n",
      "65 bottles 在啤酒墙上\n",
      "65 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "64 bottles 在啤酒墙上\n",
      "------\n",
      "64 bottles 在啤酒墙上\n",
      "64 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "63 bottles 在啤酒墙上\n",
      "------\n",
      "63 bottles 在啤酒墙上\n",
      "63 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "62 bottles 在啤酒墙上\n",
      "------\n",
      "62 bottles 在啤酒墙上\n",
      "62 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "61 bottles 在啤酒墙上\n",
      "------\n",
      "61 bottles 在啤酒墙上\n",
      "61 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "60 bottles 在啤酒墙上\n",
      "------\n",
      "60 bottles 在啤酒墙上\n",
      "60 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "59 bottles 在啤酒墙上\n",
      "------\n",
      "59 bottles 在啤酒墙上\n",
      "59 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "58 bottles 在啤酒墙上\n",
      "------\n",
      "58 bottles 在啤酒墙上\n",
      "58 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "57 bottles 在啤酒墙上\n",
      "------\n",
      "57 bottles 在啤酒墙上\n",
      "57 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "56 bottles 在啤酒墙上\n",
      "------\n",
      "56 bottles 在啤酒墙上\n",
      "56 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "55 bottles 在啤酒墙上\n",
      "------\n",
      "55 bottles 在啤酒墙上\n",
      "55 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "54 bottles 在啤酒墙上\n",
      "------\n",
      "54 bottles 在啤酒墙上\n",
      "54 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "53 bottles 在啤酒墙上\n",
      "------\n",
      "53 bottles 在啤酒墙上\n",
      "53 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "52 bottles 在啤酒墙上\n",
      "------\n",
      "52 bottles 在啤酒墙上\n",
      "52 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "51 bottles 在啤酒墙上\n",
      "------\n",
      "51 bottles 在啤酒墙上\n",
      "51 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "50 bottles 在啤酒墙上\n",
      "------\n",
      "50 bottles 在啤酒墙上\n",
      "50 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "49 bottles 在啤酒墙上\n",
      "------\n",
      "49 bottles 在啤酒墙上\n",
      "49 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "48 bottles 在啤酒墙上\n",
      "------\n",
      "48 bottles 在啤酒墙上\n",
      "48 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "47 bottles 在啤酒墙上\n",
      "------\n",
      "47 bottles 在啤酒墙上\n",
      "47 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "46 bottles 在啤酒墙上\n",
      "------\n",
      "46 bottles 在啤酒墙上\n",
      "46 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "45 bottles 在啤酒墙上\n",
      "------\n",
      "45 bottles 在啤酒墙上\n",
      "45 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "44 bottles 在啤酒墙上\n",
      "------\n",
      "44 bottles 在啤酒墙上\n",
      "44 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "43 bottles 在啤酒墙上\n",
      "------\n",
      "43 bottles 在啤酒墙上\n",
      "43 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "42 bottles 在啤酒墙上\n",
      "------\n",
      "42 bottles 在啤酒墙上\n",
      "42 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "41 bottles 在啤酒墙上\n",
      "------\n",
      "41 bottles 在啤酒墙上\n",
      "41 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "40 bottles 在啤酒墙上\n",
      "------\n",
      "40 bottles 在啤酒墙上\n",
      "40 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "39 bottles 在啤酒墙上\n",
      "------\n",
      "39 bottles 在啤酒墙上\n",
      "39 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "38 bottles 在啤酒墙上\n",
      "------\n",
      "38 bottles 在啤酒墙上\n",
      "38 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "37 bottles 在啤酒墙上\n",
      "------\n",
      "37 bottles 在啤酒墙上\n",
      "37 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "36 bottles 在啤酒墙上\n",
      "------\n",
      "36 bottles 在啤酒墙上\n",
      "36 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "35 bottles 在啤酒墙上\n",
      "------\n",
      "35 bottles 在啤酒墙上\n",
      "35 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "34 bottles 在啤酒墙上\n",
      "------\n",
      "34 bottles 在啤酒墙上\n",
      "34 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "33 bottles 在啤酒墙上\n",
      "------\n",
      "33 bottles 在啤酒墙上\n",
      "33 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "32 bottles 在啤酒墙上\n",
      "------\n",
      "32 bottles 在啤酒墙上\n",
      "32 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "31 bottles 在啤酒墙上\n",
      "------\n",
      "31 bottles 在啤酒墙上\n",
      "31 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "30 bottles 在啤酒墙上\n",
      "------\n",
      "30 bottles 在啤酒墙上\n",
      "30 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "29 bottles 在啤酒墙上\n",
      "------\n",
      "29 bottles 在啤酒墙上\n",
      "29 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "28 bottles 在啤酒墙上\n",
      "------\n",
      "28 bottles 在啤酒墙上\n",
      "28 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "27 bottles 在啤酒墙上\n",
      "------\n",
      "27 bottles 在啤酒墙上\n",
      "27 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "26 bottles 在啤酒墙上\n",
      "------\n",
      "26 bottles 在啤酒墙上\n",
      "26 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "25 bottles 在啤酒墙上\n",
      "------\n",
      "25 bottles 在啤酒墙上\n",
      "25 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "24 bottles 在啤酒墙上\n",
      "------\n",
      "24 bottles 在啤酒墙上\n",
      "24 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "23 bottles 在啤酒墙上\n",
      "------\n",
      "23 bottles 在啤酒墙上\n",
      "23 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "22 bottles 在啤酒墙上\n",
      "------\n",
      "22 bottles 在啤酒墙上\n",
      "22 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "21 bottles 在啤酒墙上\n",
      "------\n",
      "21 bottles 在啤酒墙上\n",
      "21 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "20 bottles 在啤酒墙上\n",
      "------\n",
      "20 bottles 在啤酒墙上\n",
      "20 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "19 bottles 在啤酒墙上\n",
      "------\n",
      "19 bottles 在啤酒墙上\n",
      "19 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "18 bottles 在啤酒墙上\n",
      "------\n",
      "18 bottles 在啤酒墙上\n",
      "18 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "17 bottles 在啤酒墙上\n",
      "------\n",
      "17 bottles 在啤酒墙上\n",
      "17 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "16 bottles 在啤酒墙上\n",
      "------\n",
      "16 bottles 在啤酒墙上\n",
      "16 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "15 bottles 在啤酒墙上\n",
      "------\n",
      "15 bottles 在啤酒墙上\n",
      "15 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "14 bottles 在啤酒墙上\n",
      "------\n",
      "14 bottles 在啤酒墙上\n",
      "14 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "13 bottles 在啤酒墙上\n",
      "------\n",
      "13 bottles 在啤酒墙上\n",
      "13 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "12 bottles 在啤酒墙上\n",
      "------\n",
      "12 bottles 在啤酒墙上\n",
      "12 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "11 bottles 在啤酒墙上\n",
      "------\n",
      "11 bottles 在啤酒墙上\n",
      "11 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "10 bottles 在啤酒墙上\n",
      "------\n",
      "10 bottles 在啤酒墙上\n",
      "10 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "9 bottles 在啤酒墙上\n",
      "------\n",
      "9 bottles 在啤酒墙上\n",
      "9 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "8 bottles 在啤酒墙上\n",
      "------\n",
      "8 bottles 在啤酒墙上\n",
      "8 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "7 bottles 在啤酒墙上\n",
      "------\n",
      "7 bottles 在啤酒墙上\n",
      "7 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "6 bottles 在啤酒墙上\n",
      "------\n",
      "6 bottles 在啤酒墙上\n",
      "6 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "5 bottles 在啤酒墙上\n",
      "------\n",
      "5 bottles 在啤酒墙上\n",
      "5 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "4 bottles 在啤酒墙上\n",
      "------\n",
      "4 bottles 在啤酒墙上\n",
      "4 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "3 bottles 在啤酒墙上\n",
      "------\n",
      "3 bottles 在啤酒墙上\n",
      "3 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "2 bottles 在啤酒墙上\n",
      "------\n",
      "2 bottles 在啤酒墙上\n",
      "2 bottles 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "1 bottle 在啤酒墙上\n",
      "------\n",
      "1 bottle 在啤酒墙上\n",
      "1 bottle 啤酒\n",
      "拿下一瓶给我吧\n",
      "啤酒被拿走了一瓶\n",
      "只剩一瓶了，不能给你了，要放在墙上展示\n",
      "------\n"
     ]
    }
   ],
   "source": [
    "beer_name = \"bottles\"\n",
    "\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num,beer_name,\"在啤酒墙上\")\n",
    "    print(beer_num,beer_name,\"啤酒\")\n",
    "    print(\"拿下一瓶给我吧\")\n",
    "    print(\"啤酒被拿走了一瓶\")\n",
    "    # 情况一：只剩一瓶的情况\n",
    "    if beer_num == 1:\n",
    "        print(\"只剩一瓶了，不能给你了，要放在墙上展示\")\n",
    "    # 情况二：还有多于1瓶的情况\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            beer_name = \"bottle\"\n",
    "        print(new_num,beer_name,\"在啤酒墙上\")\n",
    "    print(\"------\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "274b5f7a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
